<template>
  <el-row :gutter="40" class="panel-group">
    <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-people">
          <svg-icon icon-class="xueshu" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">学术科技与创新创业</div>
          <count-to :start-val="0" :end-val="count.classif_x || 0" :decimals="2" :duration="2500" class="card-panel-num"/>
        </div>
      </div>
    </el-col>
    <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-message">
          <svg-icon icon-class="wenhua" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">文化艺术与身心发展</div>
          <count-to :start-val="0" :end-val="count.classif_w || 0" :decimals="2" :duration="2500" class="card-panel-num"/>
        </div>
      </div>
    </el-col>
    <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-money">
          <svg-icon icon-class="gongyi" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">公益服务与社会实践</div>
          <count-to :start-val="0" :end-val="count.classif_g || 0" :decimals="2" :duration="2500" class="card-panel-num"/>
        </div>
      </div>
    </el-col>
    <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-shopping">
          <svg-icon icon-class="shetuan" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">社团活动与社会工作</div>
          <count-to :start-val="0" :end-val="count.classif_s || 0" :decimals="2" :duration="2500" class="card-panel-num"/>
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'
import { getStudentCreditCount } from '@/api/credit'

export default {
  components: {
    CountTo
  },
  data() {
    return {
      count: {}
    }
  },
  created() {
    const user_id = this.$store.getters.userInfo.user_id
    getStudentCreditCount(user_id).then(res => {
      this.count = res.data
    }).catch(() => {})
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

.panel-group {
  margin-top: 18px;
  .card-panel-col{
    margin-bottom: 32px;
  }
  .card-panel {
    height: 108px;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    .icon-people {
      color: #40c9c6;
    }
    .icon-message {
      color: #36a3f7;
    }
    .icon-money {
      color: #f4516c;
    }
    .icon-shopping {
      color: #34bfa3
    }
    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }
    .card-panel-icon {
      float: left;
      font-size: 54px;
    }
    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }
      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@mixin minPanel {
  .card-panel-icon  {
    font-size: 40px !important;
  }
  .card-panel-text {
    font-size: 14px !important;
  }
  .card-panel-icon-wrapper {
    margin-left: 0 !important;
  }
  .card-panel-description {
    margin-right: 16px !important;
  }
}

@media screen and (max-width: 350px) {
  @include minPanel;
}
@media screen and (max-width: 1500px) and (min-width: 1200px) {
  @include minPanel;
}

@media screen and (max-width: 1200px) {
  .card-panel-description {
    float: left !important;
  }
}
</style>
